package com.yxhl.km.module.login.mvp;

import com.yxhl.km.module.login.entity.UserInfoBean;
import com.yxhl.km.mvp.BaseView;

/**
 * Created by 张亚楠 on 2018/5/21.
 * 通过p层将View层和Model进行关联
 */

public class LoginPrensenter {
    private BaseView loginView;
    private LoginMoudle loginMoudle;

    public LoginPrensenter(BaseView loginView) {
        this.loginView = loginView;
        this.loginMoudle = new LoginMoudle();
    }

    /**
     * 登录接口
     *
     * @param phone
     * @param password
     */
    public void getLoginData(String phone, String password) {
        this.loginMoudle.getLoginData(phone, password, new ResultBean<UserInfoBean>() {
            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onResult(UserInfoBean userInfoBean) {
                loginView.onResult(userInfoBean);
            }

        });

    }
}
